r = 1 gotknife = 1 man = 1 SCREEN 12 COLOR 7, 0 CLS DIM SHARED DOOM AS DOUBLE Minutes = 10 Seconds = 0 GameTime = Minutes * 60 + Seconds DIM directions(1 TO 9) AS STRING directions(1) = "WEST" directions(2) = "EAST OR SOUTH" directions(3) = "NORTH OR SOUTH" directions(4) = "NORTH, SOUTH, EAST, OR WEST" directions(5) = "EAST" directions(6) = "WEST" directions(7) = "NORTH OR EAST" directions(8) = "WEST OR SOUTH" directions(9) = "NORTH" PRINT "" PRINT "" PRINT "A cabin rests in the woods and you are seeking peace and quiet. But alas the" PRINT "human mind isn't always so accommodating. You are recovering from a nervous" PRINT "breakdown which has left you on edge. The world around you is lying to you," PRINT "you feel sick, as the place that you thought will bring you peace, is slowly" PRINT "driving you mad." PRINT "" DO: LOOP UNTIL INKEY$ <> "" DOOM = TIMER(0.001) + GameTime 'change this to to desied time for the game to run DO CLS PRINT PRINT PRINT " " PRINT " " PRINT " " PRINT " The Cabin " PRINT " " PRINT " Written by " PRINT " " PRINT " D.B. Taylor" PRINT "" PRINT " Copyright (c) 2015" PRINT "" PRINT SPACE$(38); IF INSTR(directions(r), "NORTH") THEN PRINT "N" ELSE PRINT PRINT "*---------------------------------* "; IF INSTR(directions(r), "WEST") THEN PRINT "W"; ELSE PRINT " "; PRINT " + "; IF INSTR(directions(r), "EAST") THEN PRINT "E"; ELSE PRINT " "; PRINT " *------------------------------------*" PRINT SPACE$(38); IF INSTR(directions(r), "SOUTH") THEN PRINT "S" ELSE PRINT PRINT PRINT "If you are stuck just type HELP." PRINT GOSUB ROOM GOSUB parser LOOP ROOM: IF r = 1 THEN: GOSUB r1 IF r = 2 THEN: GOSUB r2 IF r = 3 THEN: GOSUB r3 IF r = 4 THEN: GOSUB r4 IF r = 5 THEN: GOSUB r5 IF r = 6 THEN: GOSUB r6 IF r = 7 THEN: GOSUB r7 IF r = 8 THEN: GOSUB r8 IF r = 9 THEN: GOSUB r9 RETURN parser: PRINT "> "; cmd$ = GrabInput cmd$ = LTRIM$(RTRIM$(UCASE$(cmd$))) IF cmd$ = "END" OR cmd$ = "QUIT" OR cmd$ = "EXIT" OR cmd$ = "Q" THEN END END IF IF cmd$ = "HELP" OR cmd$ = "H" OR cmd$ = "?" THEN CLS PRINT "HERE ARE SOME BASIC COMMANDS THAT CAN BE USED IN THE GAME..." PRINT PRINT "NORTH, EAST ,SOUTH, AND WEST - MOVE TO AN AVAILABLE LOCATION" PRINT "EXAMINE (OBJECT) - EXAMINE AN OBJECT" PRINT "USE (OBJECT) - USE AN OBJECT" PRINT "TAKE (OBJECT) - TAKE OR MOVE AN OBJECT" PRINT "INVENTORY - VIEW YOUR INVENTORY" PRINT "DRINK - DRINK BEER" PRINT "UNLOCK - UNLOCK DOOR" PRINT "HELP - VIEW THIS SCREEN" PRINT "END - END GAME" PRINT PRINT "PRESS ANY KEY...": SLEEP DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF cmd$ = "INVENTORY" OR cmd$ = "INV" OR cmd$ = "ITEMS" OR cmd$ = "I" THEN CLS PRINT "INVENTORY..." PRINT IF gotknife = 1 THEN: PRINT "An average butterknife." PRINT PRINT "PRESS ANY KEY..." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF cmd$ = "GO NORTH" OR cmd$ = "NORTH" OR cmd$ = "N" THEN IF r = 7 THEN: r = 4: GOTO moved IF r = 4 THEN: r = 3: GOTO moved IF r = 3 THEN: r = 2: GOTO moved IF r = 9 THEN: r = 8: GOTO moved END IF IF cmd$ = "GO EAST" OR cmd$ = "EAST" OR cmd$ = "E" THEN IF r = 2 THEN: r = 1: GOTO moved IF r = 5 THEN: r = 4: GOTO moved IF r = 4 THEN: r = 6: GOTO moved IF r = 7 THEN: r = 8: GOTO moved END IF IF cmd$ = "GO SOUTH" OR cmd$ = "SOUTH" OR cmd$ = "S" THEN IF r = 2 THEN: r = 3: GOTO moved IF r = 3 THEN: r = 4: GOTO moved IF r = 4 THEN: r = 7: GOTO moved IF r = 8 THEN: r = 9: GOTO moved END IF IF cmd$ = "GO WEST" OR cmd$ = "WEST" OR cmd$ = "W" THEN IF r = 1 THEN: r = 2: GOTO moved IF r = 6 THEN: r = 4: GOTO moved IF r = 4 THEN: r = 5: GOTO moved IF r = 8 THEN: r = 7: GOTO moved END IF IF (cmd$ = "USE KNIFE") THEN CLS PRINT "On what?" DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "EXAMINE MAN") AND r = 5 THEN CLS PRINT "He stands before you wearing a white Doctor's coat. He seems to be" PRINT "just standing before you...he's not even blinking...he has his hands" PRINT "in his pockets...and with a sickly grin upon his face." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "EXAMINE KNIFE") AND gotknife = 1 THEN CLS PRINT "Just an average run of the mill butterknife. Nothing to write home" PRINT "about." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "USE KNIFE") AND gotknife = 1 AND r = 5 THEN CLS GOTO lose: DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "LEAVE CABIN") THEN CLS GOTO win: DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF moved: RETURN r1: PRINT "You are standing in the entranceway of this simple cabin. You" PRINT "wish for peace and quite." RETURN r2: PRINT "Being barefoot and walking across the hardwood floor feels great." RETURN r3: PRINT "It's a shame you never decorated this place. Your Father left it" PRINT "to you and he did want you to enjoy it." RETURN r4: PRINT "The smell of nature, it fills every room, and hall with the scent" PRINT "of joy and new life." RETURN r5: PRINT "You are standing on the cusp of a small room. A man is standing" PRINT "there. Just who or what he wants? Is baffling." RETURN r6: PRINT "You hear voices, calling out in laughter...just what does this all" PRINT "mean?" RETURN r7: PRINT "You arrive at a turning point, the hallway cuts off towards an empty" PRINT "room. Funny how there's not kitchen or even a lamp!" RETURN r8: PRINT "You feel a stabbing pain in the back of your head. As if you were hit" PRINT "by something?" RETURN r9: PRINT "A dead end, nothing at all but another white wall. Just what the hell" PRINT "is happening here? Just what is happening here?" RETURN win: COLOR 2, 0 CLS PRINT "You awaken to find yourself lying down on a bed large enough" PRINT "for only one person. A cell? I'm in a cell...a padded cell." PRINT "The door opens up and in steps the Doctor from the dream. He" PRINT "tells you that the treatment is going as planned and soon you" PRINT "return home. The thought of this brings a smile to your face." PRINT "Home...Mom...Dad...I'm going to be home again." PRINT DO: LOOP UNTIL INKEY$ <> "" END lose: COLOR 2, 0 CLS PRINT "You find yourself not in a cabin in the woods. But within a padded" PRINT "cell. Blood covers your hands as the Doctor screams out in pain." PRINT "It turns out that you stole his pen and acted out...you spend the" PRINT "rest of your life behind padded walls." PRINT DO: LOOP UNTIL INKEY$ <> "" END FUNCTION GrabInput$ x = POS(0) y = CSRLIN maxwidth = _WIDTH - x PCOPY 0, 1 'make a backup copy of the screen DO k = _KEYHIT i$ = INKEY$ LOOP UNTIL k = 0 AND INKEY$ = "" 'clear the keyboard buffer DO _LIMIT 30 PCOPY 1, 0 LOCATE y, x: PRINT Userinput$ k = _KEYHIT SELECT CASE k CASE 8 Userinput$ = LEFT$(Userinput$, LEN(Userinput$) - 1) CASE 65 TO 90, 97 TO 122, 32 Userinput$ = UCASE$(Userinput$ + CHR$(k)) END SELECT timerleft## = (DOOM - TIMER(0.001)) minutes = timerleft## \ 60 seconds = timerleft## - minutes * 60 LOCATE 2, 32: PRINT USING " ###:##.###"; minutes, seconds IF timerleft## <= 0 THEN GOTO doomed _DISPLAY LOOP UNTIL k = 13 GrabInput$ = Userinput$ _AUTODISPLAY EXIT FUNCTION doomed: CLS PRINT "You awaken from the dream, confused, and lost. The next day you are told" PRINT "that it's nothing but the medication kicking in...pity!" _DISPLAY END END SUB